﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ClassLibrary2
{
    public class Element : IEquatable<Element>
    {
        public string tagName = string.Empty;
        public object tagValue = null;
        public string tagType = string.Empty;
        public bool isTagOnly= false;
        public string tableName = string.Empty;
        public string columnSize = string.Empty;
        public string allowDbNull = string.Empty;
        public Element parent;

        public Element()
        {
        }
        public Element(string tagName)
        {
            this.tagName = tagName;
        }
        public Element(string tagName, bool isTagOnly)
        {
            this.isTagOnly = isTagOnly;
            this.tagName = tagName;
        }

        public bool Equals(Element other)
        {
            if (this.tagName.ToLower().Trim() == other.tagName.ToLower().Trim())
            {
                if (tagValue == null && other.tagValue == null)
                {
                    return true;
                }
                if (tagValue != null && other.tagValue != null && tagValue.ToString() == other.tagValue.ToString())
                {
                    return true;
                }
            }
            return false;
        }
    }
}
